<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <!--isLogin 初始值是FALSE 但是需要FALSE时让元素显示 所以加!取反-->
  <div v-if="!isLogin">
    <!--javascript:void(0)  禁止超链接的跳转功能-->
    <a href="javascript:void(0)">注册</a>
    <a href="javascript:void(0)" @click="isLogin=true">登录</a>
  </div>
  <div v-else>
    <input type="text" v-model="newName" placeholder="名字">
    <a href="javascript:void(0)" @click="arr.push(newName)">添加</a>
    <a href="javascript:void(0)" @click="isLogin=false">退出</a>
  </div>
  <ul>
    <li v-for="name in arr">{{name}}</li>
  </ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
  let v=new Vue({
    el:"body div",
    data:{
      isLogin:false,
      arr:["刘备","关羽"],
      newName:""
    }

  })
</script>

</body>
</html>